<!DOCTYPE html>
<html lang="en">

	<head>
		<meta charset="UTF-8">
		<title>注册帐号</title>
	</head>

	<body>
		< <div align="center" style="background-color: aliceblue">
			<form action="./suc.html" id="one">
				<table border="0" cellspacing="0" align="center" id="two">
					<tr>
						<th align="right">帐号</th>
						<td><input type="text" name="name" id="n1"></td>
					</tr>
					<tr>
						<th align="right">手机号</th>
						<td><input type="text" name="tel" id="t1"></td>
					</tr>
					<tr>
						<th align="right">身份证</th>
						<td><input type="text" name="idcard" id="i1"></td>
					</tr>
					<tr>
						<th align="right">密码</th>
						<td><input type="password" name="pwd" id="p1"></td>
					</tr>
					<tr>
						<th align="right">确认密码</th>
						<td><input type="password" name="pwd" id="p2"></td>
					</tr>
				</table>
				<input type="button" id="but1" value="注册" onclick="sub()">
				<input type="reset" id="but2" value="重置">
				<br>
				<a href="login.html">已有帐号，点击登录</a>

			</form>
			</div>
			<script type="text/javascript">
				function sub() {
					if(document.getElementById("n1").value.length == 0 || document.getElementById("n1").value.length > 20) {
						alert("请输入正确的帐号");
						return;
					} else if(document.getElementById("t1").value.length == 0) {
						alert("手机号不能为空");
						return;
					} else if(document.getElementById("i1").value.length == 0) {
						alert("身份证号不能为空");
						return;
					} else if(document.getElementById("p1").value.length == 0 || document.getElementById("p1").value.length > 16) {
						alert("请输入正确的密码（0-16位）");
						return;
					} else if(document.getElementById("p1").value != document.getElementById("p2").value) {
						alert("两次输入的密码不同！");
						return;
					} else {
						document.getElementById("one").submit();
					}
				}
			</script>

	</body>

</html>